from django.contrib import admin
from machine.models import Problem, Coder, Submission, TestCase, CodeUsers, Category, Tag, Post

admin.site.register(Problem)
#admin.site.register(Coder)
admin.site.register(CodeUsers)
admin.site.register(Submission)
admin.site.register(TestCase)
admin.site.register(Category)
admin.site.register(Tag)
admin.site.register(Post)

class PostAdmin(admin.ModelAdmin):
	list_display = ['title', 'created_time', 'modified_time', 'category', 'author']
	fields = ['title', 'body', 'excerpt', 'category', 'tags']
	def save_model(self, request, obj, form, change):
		obj.author = request.user
		super().save_model(request , obj, form, change)